Anas bin Malik, may Allah be pleased with him, reported:
Allah's Messenger (may peace be upon him) said: Allah, the Exalted and Glorious, has appointed an angel as the care-taker of the womb, and he would say: My Lord, it is now a drop of semen; my Lord, it is now a clot of blood; my Lord, it has now become a lump of flesh, and when Allah decides to give it a final shape, the angel says: My Lord, would it be male or female or would he be an evil or a good person? What about his livelihood and his age? And it is all written while he is in the womb of his mother. Hadith number 4785 in Sahih Muslim