Oto przykład przekazywania parametru wycenianego w tabeli do sp_executesql . Zmienna musi być przekazana readonly :
if exists (select * from sys.types where name = 'TestTableType')
drop type TestTableType
create type TestTableType as table (id int)
go
declare @t TestTableType
insert @t select 6*7
exec sp_executesql N'select * from @var', N'@var TestTableType readonly', @t