Reference : Hisn al-Muslim 243

ضَعْ يَدَكَ عَلَى الَّذِي تَألَّمَ مِنْ جَسَدِكَ وَقُلْ:
"بِسْمِ اللَّهِ" ثَلاَثاً، 
وَقُلْ سَبْعَ مَرَّاتٍ: 
"أَعُوذُ بِاللَّهِ وَقُدْرَتِهِ مِنْ شَرِّ مَا أَجِدُ وَأُحَاذِرُ"
Put your hand on the place where you feel pain and say: 
Bismillāh (three times).
Then say seven times:
A`ūdhu billāhi wa qudratihi min sharri mā ajidu wa uḥādhir.


Put your hand on the place where you feel pain and say:
With the Name of Allah (three times).

Then say seven times:
I seek refuge in Allah and in His Power from the evil of what I find and of what I guard against.

Reference:
Muslim 4/1728.

Chapter: When feeling some pain in the body