• You don't have #table or @table in your original post so it clearly isn't the whole procedure. Please post the full definition of the stored procedure and the definition of #table/@table.