i dont want my stored procedure to compile if a table it references does not exists.
Answer by Magnus Ahlkvist ·
The workaround would be to run the stored procedure (inside a transaction if it's a proc which will change stuff).
I think even getting the estimated execution plan for the exec-statement for the procedure will spot the error, because then you'll get a compilation error at statement-level. But I'm not 100% sure about that, and if your stored procedure uses temporary tables, it won't work to get the estimated execution plan anyway, then your only option would be to execute the proc.