Answer
Both forms of Tahajjud are correct – before sleep and after sleep.
It was the noble habit of Rasulullah (Sallallaahu Alayhi Wasallam) to sleep
and then wake up for Tahajjud. If one is unable to wake up for Tahajjud,
then one may perform Tahajjud before going to sleep.
and Allah Ta’ala Knows Best
Mufti Ebrahim Desai