There are types of brain surgeries that do require a person to remain conscious. This can allow surgeons to judge if any complications are arising during surgery.
To my knowledge, the doctors wake up you after the section of your skull is removed. They can do this because your brain had no nerve ending so a person doesn't not feel pain while the brain surgeons...
It would depend on the procedure being performed and in some cases personal preference. You would be most likely sedated for a very invasive procedure.
Often times, doctors need to test if the patient can speak or move a certain limb and they could not do this if the person was asleep. The doctors simply numb the area.