Medication and Weight Loss

I am currently taking medication that causes weight gain. I am still watching my calories and exercising most days. I have only lost 10lbs and have been holding steady there for a while. It wasn't until I mentioned to my doctor about my trying to lose weight and can't that she told me the medication is working against me right now and that I won't be able to lose weight. I am thinking because I am watching my calories and exercising that is the reason why I haven't gained any weight.
Has anyone else had this? Were you able to lose weight? And if and when you stopped the medication did it make a big difference in your losing weight?

I appreciate if anyone can share their experiences. Thanks!