Urwah bin al-Zubayr (may Allah have mercy on him) narrated that Sayyiduna Hakim bin Hizam (may Allah be pleased with him) told him that he said to the Messenger of Allah (peace and blessings be upon him): What do you think about the deeds I used to do in the Days of Ignorance with the intention of righteousness; will I receive any reward for them? The Messenger of Allah (peace and blessings be upon him) said to him: "You have embraced Islam along with the good deeds you did before."
Hadith Referenceالمعجم الكبير للطبراني / باب الحاء / 3074