Reply to Message

My solution
I did this a while ago and it's running in several production stored procedures.

Essentially you need to form a dynamic SQL statement by stitching together strings and then execute it. See here for the full post - http://www.geakeit.co.uk/2011/02/05/a-table-input-variable-in-a-stored-procedure-and-bypassing-must-declare-the-table-variable-msg-1087/
Posted by joshgeake
15th Apr 2011