The optimizer, which is what is used to generate Estimated Execution plans, doesn't execute T-SQL. It does run the state­ments through the algebrizer , the process outlined earlier that is responsible for verifying the names of database objects.

Since the query has not yet been executed, the temporary table does not yet exist. This is the cause of the error.

One way to solve this (and test the execution plan) is to create the #temp table before and make a insert into instead of select ... into in the stored procedure.