what error does it throw?
have you written
'declare @tablevariable varchar(100)
set @tablevariable = 'any valid table name'
Before code C?
map @tablevariable to one of your database table, select that database as current database and then execute the code