All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallahu ʻalayhi wa sallam, is His slave and Messenger.
If you really need this medicine, then there is no harm on you in taking it as long as it is not intoxicating (it does not make you drunk). We do not want to get into details regarding the juridical basis of this opinion, based on the assumption that the alcohol that intoxicates when consumed in a large amount is considered Khamr (prohibited alcoholic beverage) under the Shariah.
However, it is worth adding here that there is a strong scholarly view regarding the ruling on alcohol (used in medicine and the like); it holds that such alcohol is not classified as Khamr even if it intoxicates, because the definition of Khamr in the Shariah is the intoxicating beverage; i.e. what a person drinks and it makes him drunk as a result. However, alcohol (used in medicine and the like) is not a beverage. This view was adopted by the Egyptian Daar Al-Iftaa’, which published a detailed fatwa to that effect on its website. Some researchers underlined that this opinion is in accord with the four mainstream schools of Fiqh followed by the Muslims.
Allah knows best.