There is nothing wrong with using anaesthetic in order to perform surgery
Firstly:
It is haraam for a person to consume anything that will take away his senses with no excuse, whether that is alcohol or anything else.
Shaykh al-Islam Ibn Taymiyah said:
Everything that takes away one's senses is haraam, even if it does not result in drunkenness or intoxication. If it takes away the senses it is haraam according to the consensus of the Muslims. End quote.
Majmoo’ al-Fataawa, 34/211
Secondly:
Khamr (usually translated as wine or alcohol) is that which takes away the senses in the form of pleasure, drunkenness and intoxication. This is the intoxicant for which the one who consumes it must be given the hadd punishment.
As for that which takes away the senses without any kind of pleasure or intoxication, this is not regarded as an intoxicant.
See al-Sharh al-Mumti’, 11/163.
Shaykh al-Islam Ibn Tayimiyah (may Allaah have mercy on him) stated in several places that banj (lit. henbane or hyoscyamus niger, a narcotic and poisonous plant) is not an intoxicant.
Majmoo’ al-Fataawa, 14/117; 33/104; 34/198.
Thirdly:
The majority of scholars are of the view that it is permissible to use anaesthetics in cases of necessity, such as amputations or operations and the like.
See al-Mawsoo’ah al-Fiqhiyyah, 8/217.
It says in Asna al-Mataalib (4/160):
He may take it (henbane or anaesthetic) in order to become unconscious when having a diseased limb amputated. End quote.
Shaykh Ibn ‘Uthaymeen said:
As for anaesthetic, there is nothing wrong with it, because it is not an intoxicant. Intoxicants make a person lose his senses by way of pleasure and drunkenness, but the one who is anaesthetized does not feel any pleasure. Hence the scholars said that banj is halaal and there is nothing wrong with it, i.e., if there is a need for it in order to perform surgery and the like.
Liqaa’aat al-Baab il-Maftoohah (3/231):
This is unlike khamr (alcohol). In the answer to the question (41760) we have stated that it is not permissible to drink alcohol for medicinal purposes. The Prophet (peace and blessings of Allaah be upon him) said: “It – i.e., alcohol – is not a remedy, rather it is a disease.” Narrated by Muslim.