If I understand correctly, you were working in a hospital earlier and you also did your PhD alongside. It is unclear from your question whether or not the hospital you worked at was affiliated to a university. You have mentioned that at present, you are working in a pharmaceutical company; again, it is unclear whether you are working full-time or part-time. It is also unclear whether or not you did any part of your PhD work at the pharmaceutical company that you are currently employed at.
If you have not done any part of your PhD work in the pharmaceutical industry where you are presently working, there is no binding on you to put your affiliation as a “medical advisor in the pharma company.” On the other hand, if you have carried out parts of your PhD work in this pharma company, then you will need to check how to acknowledge them.
One aspect that should be taken into consideration is: are you still registered at the university as a PhD candidate or has your registration been revoked? If you are still registered as a candidate at the university, you can put your affiliation as “Research Scholar, Department of XYZ, University of ABC.” However, if your registration has been revoked, then you need to confirm with your university for a re-registration process.