Because it is out of scope. You need to include table definition inside EXEC as well.
Execute('declare @temptable table (id int, name varchar(50)); select * from @temptable ' )
But frankly why do you need this?
Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"