It was the era of Hazrat Musa (علیہ السلام); there was an extremely sinful man in the Bani Isra'il. He spent almost hundred years in disobedience. When he died, Bani Isra'il did not even care about his funeral and threw him in filth-piles. Allah revealed to His beloved Kaleem (علیہ السلام), “Our friend has died, order your nation to honor him and perform his funeral with respect.” Hazrat Musa (علیہ السلام) did the same. Afterwards, he asked Allah that that man was so sinful then how did he deserve such a great reward? Allah replied, “O Musa! Once he opened Torah and came across the name of Muhammad (ﷺ). His heart filled with the love of my beloved Muhammad (ﷺ), he kissed his (ﷺ) name, respected it and recited Durud on him (ﷺ). Due to this admiration, I forgave all his sins.”
(References: Maqasid-us-Salikeen page 50, Al-Qaul-ul-Badee page 118, Seerat Volume 1 page 80)A tested practice: If someone does not have sons, he should put his hand on his wife’s tummy when she gets pregnant and recite []. In sha Allah, he will be blessed with bay boy.