It is narrated from Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) that when the Prophet (peace and blessings be upon him) wished to seek Allah's guidance (istikharah) about a matter he intended to do, he would say: "O Allah, I seek good from You by Your knowledge, and I seek ability from You by Your power, and I ask You of Your bounty; for You have power and I have no power, and You know and I do not know, and You are the Knower of the unseen. O Allah, if this matter is better for me in my religion, and better for me in my livelihood, and better for me in that by which I seek good, then choose it for me with well-being and make it easy, then bless me in it. And if something other than it is better for me, then decree good for me wherever it may be."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 10016