The question is not clear. Do you want to gain weight to avoid serious side effects of drugs?. Is this what you are trying to do?, because if so, it is better to stop doing drugs all together than to try to gain weight to counter its use.
Drugs are not good for you period. If you are trying to gain weight for medical reasons and it has been suggested by a medical professional, such professional should have told you healthy alternatives to achieve your goal.