The Sunnah of the Prophet is fixed
Supplication when entering and leaving the mosque
On the authority of Abu Hamid Al-Saadi
Or on the authority of Abu Asid, may God be pleased with them both
He said
The Messenger of God, may God bless him and grant him peace, said
If one of you enters the mosque, let him say:
Oh God, open the doors of His mercy for me
And if he comes out, let him say it
Oh God, I ask you please
Narrated by Muslim