The gemara says (Brachos 60a, on the bottom):
אמר רב אחא הנכנס להקיז דם אומר יהי רצון מלפניך יי’ אלקי שיהא עסק זה לי לרפואה ותרפאני כי אל רופא נאמן אתה ורפואתך אמת לפי שאין דרכן של בני אדם לרפאות אלא שנהגו
Rav Acha said that someone who goes for bloodletting should say “May it be Your Will, Hashem my God, that this practice should be a healing, and I should be healed; for You are a trustworthy Healer and your healing is true,” because people don’t get healed by themselves (they need God to heal them).
( free translation )
This is brought down by the Rambam, Hilchot Berachot 10:21 (as well as Shulchan Aruch, Orach Chaim 230:4, who writes pretty much exactly the same wording as the Rambam). Here is what the Rambam says:
הַנִּכְנָס לְהַקִּיז דָּם אוֹמֵר יְהִי רָצוֹן מִלְּפָנֶיךָ יְיָ’ אֱלֹהַי שֶׁיְּהֵא עֵסֶק זֶה לִי לִרְפוּאָה כִּי רוֹפֵא חִנָּם אָתָּה. וּכְשֶׁיֵּצֵא אוֹמֵר בָּרוּךְ אַתָּה יְיָ’ רוֹפֵא חוֹלִים
One who goes for bloodletting should say “May it be Your Will, Hashem my God, that this practice should be a healing for me, because you are a free Doctor.” When he is finished, he should say “Blessed are You, O God, Healer of the sick.”
( free translation )
I’ve seen some cite the above Shulchan Aruch to require saying this before taking any medicine1 (I do this without using שם השם, when I remember to), even though he only said it regarding bloodletting. I would argue that bloodletting is close enough to surgery so that the same prayer can be used.
1Some have even made this into a card to hand out, as mentioned in one of the comments to the question.
Discover and share Encouraging Quotes For Someone Having Surgery. Explore our collection of motivational and famous quotes by authors you know and love.
Get Well Messages for Someone Having Surgery. Updated on … things to write in a get well card for someone having surgery. … encouraging quotes.
Encouraging Words For Someone Having Surgery quotes – 1. Being there for someone takes more than just saying the words ‘I’m here if you need me.’ Remember …
Free download of nice encouragement messages before surgery: … phrase from someone who loves … Before Surgery | Encouraging Quotes added by …
Encouraging Quotes For Someone Having Surgery. QuotesGram by @quotesgram
Encouraging Quotes For Someone Having Surgery. QuotesGram by @quotesgram. Encouraging Quotes For Someone Having Surgery. QuotesGram by @quotesgram.
Inspirational For Someone Having Surgery quotes – 1. True heroes are those that go that extra mile for someone. That put their heart and soul in helping …
Bible verses for surgery Having gone into surgery twice I know it can be a scary time not only for you, but for your family as well. … Quotes “Let your …
Send beautiful texts before a surgery We should be more conscious about how important it is to maintain a good health as it allows us to do all the things …
May you find great value in these Surgery Quotes and Inspirational Quotes … If somebody wants to have plastic surgery, … I’m having surgery today to …