There is no secret cure to stop gaining weight if you drink on top of a unhealthy diet and little exercise.
Beer has the most calories, so you could switch to something like vodka waters or gin waters on ice, as you would be intaking the same amount of alcohol with half the calories.
Otherwise, proper diet and exercise outside of drinking is all there is to it.
I don't have an unhealthy diet and I exercise at least 3 times a week bare minimum so I don't know why you'd add in that comment.
I think that if you drink enough, it doesn't matter how healthy your diet is and how much you exercise though, unless your metabolism is through the roof you are going to gain weight I guess.