Can I have surgery if I’m pregnant?

So, I’m having surgery this Friday for smithing small but it requires medication to put me to sleep and numbing. Very good possibility i conceived this month but I’m still on my two week wait and it’s too early to test. If I am pregnant will the baby be okay through surgery?