>I get the same error
Of course you'll get it. Maybe I must go to sleep and not to give such stupid answers. EXEC ... doesn't see declared local variable, because it is local :o). Look in Sergey's answer.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.