This question already has an answer here:
I've read all the books years ago. While I was re watching the movies earlier, some things don't tie up.
In the Philosopher's Stone:
Why was Snape helping Harry all the time, and why he was questioning Quirrell on which side he really was?
I remember very well that in the Deathly Hallows Snape pretended to the end to be Voldemort's Death Eater.
My question is how did Voldemort trust Snape in book 7 if in book 1 he was trying to stop Quirrell.
And Voldemort was aware about it:
"Yes, Severus does seem the type, doesn't he? So useful to have him swooping around like an overgrown bat. Next to him, who would suspect p-p-poor, st-stuttering P-Professor Quirrell?"
—Quirrell (possibly influenced by Voldemort) on Harry's suspicions about Snape after revealing himself