Its found in the Gemera Brachot 55b:
""רבונו של עולם, אני שלך וחלומותי שלך. חלום חלמתי ואיני יודע מה הוא, בין שחלמתי אני לעצמי, ובין שחלמו לי חבירי, ובין שחלמתי על אחרים, אם טובים הם חזקם ואמצם כחלומותיו של יוסף, ואם צריכים רפואה רפאם כמי מרה על ידי משה רבינו וכמרים מצרעתה וכחזקיה מחליו וכמי יריחו על ידי אלישע, וכשם שהפכת קללת בלעם הרשע לברכה כן הפוך כל חלומותי עלי לטובה."
"Master of the Universe, I am Yours and my dreams are Yours,
I dreamed a dream and I do not know what it is.
Whether I have dreamed of myself, whether my friends have dreamed of me or whether I have dreamed of others,
if the dreams are good, strengthen them and reinforce them like the dreams of Joseph.
And if the dreams require healing,
heal them like the bitter waters of Mara by Moses our teacher, and like Miriam from her leprosy,
and like Hezekiah from his illness, and like the bitter waters of Jericho by Elisha.
And just as You transformed the curse of Balaam the wicked into a blessing,
so transform all of my dreams for me for the best."
Here is a link that brings Commentary and Halachic authorities to explain the idea more: https://www.sefaria.org/sheets/136277.1?lang=bi&with=all&lang2=en