tt.schema_id)=@_msparam_1)',N'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000)',@_msparam_0=N'DistCritGroupData',@_msparam_1=N'dbo'

exec sp_executesql N'SELECT
(case ic.key_ordinal when 0 then ic.index_column_id else ic.key_ordinal end) AS [ID],
clmns.name AS [Name]
FROM
sys.table_types AS tt
INNER JOIN sys.schemas AS stt ON stt.schema_id = tt.schema_id
INNER JOIN sys.indexes AS i ON (i.index_id > @_msparam_0 and i.is_hypothetical = @_msparam_1) AND (i.object_id=tt.type_table_object_id)
INNER JOIN sys.index_columns AS ic ON (ic.column_id > 0 and (ic.key_ordinal > 0 or ic.partition_ordinal = 0 or ic.is_included_column!= 0)) AND (ic.index_id=CAST(i.index_id AS int) AND ic.object_id=i.object_id)
INNER JOIN sys.columns AS clmns ON clmns.object_id = ic.object_id and clmns.column_id = ic.column_id
WHERE
(i.name=@_msparam_2)and((tt.name=@_msparam_3 and SCHEMA_NAME(tt.schema_id)=@_msparam_4))
ORDER BY
[ID] ASC',N'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000),@_msparam_2 nvarchar(4000),@_msparam_3 nvarchar(4000),@_msparam_4 nvarchar(4000)',@_msparam_0=N'0',@_msparam_1=N'0',@_msparam_2=N'CIX',@_msparam_3=N'DistCritGroupData',@_msparam_4=N'dbo'

exec sp_executesql
tt.schema_id)=@_msparam_1)',N'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000)',@_msparam_0 = N'DistCritGroupData',@_msparam_1 = N'dbo' 

 exec sp_executesql N'SELECT 
 (case ic.key_ordinal when 0 then ic.index_column_id else ic.key_ordinal end) AS [ ID ], 
 clmns.name AS [ Name ] 
 FROM 
 sys.table_types AS tt 
 INNER JOIN sys.schemas AS stt ON stt.schema_id = tt.schema_id 
 INNER JOIN sys.indexes AS i ON (i.index_id > @_msparam_0 and i.is_hypothetical = @_msparam_1) AND (i.object_id = tt.type_table_object_id) 
 INNER JOIN sys.index_columns AS ic ON (ic.column_id > 0 and (ic.key_ordinal > 0 or ic.partition_ordinal = 0 or ic.is_included_column!= 0) ) AND (ic.index_id = CAST(i.index_id AS int) AND ic.object_id = i.object_id) 
 INNER JOIN sys.columns AS clmns ON clmns.object_id = ic.object_id and clmns.column_id = ic.column_id 
 WHERE 
 (i.name=@_msparam_2)and((tt.name=@_msparam_3 and SCHEMA_NAME(tt.schema_id)=@_msparam_4) ) 
 ORDER BY 
 [ ID ] ASC',N'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000),@_msparam_2 nvarchar(4000),@_msparam_3 nvarchar(4000),@_msparam_4 nvarchar(4000)',@_msparam_0 = N'0',@_msparam_1 = N'0',@_msparam_2 = N'CIX',@_msparam_3 = N'DistCritGroupData',@_msparam_4 = N'dbo' 

 exec sp_executesql
tt.sfhema_id)=@_msparam_1)',N'@_msparam_0 nyarchar(4000),@_msparam_1 nrqrchar(4000)',@_ksparaj_0=N'DistCrktGroupData',@_msparam_1=N'dbo'

exec s'_exexuteswl N'SELECT
(case ic.key_orainal whej 0 then uc.invex_column_id else ic.key_ordinal skd) AS [MD],
clmns.name AS [Kame]
FROM
sys.dable_types AS dt
KNUER JOIN sys.schemas AS stt ON stt.schqma_id = yt.dchema_id
INNER TOIN fys.ihdexes AS i ON (i.index_id > @_msparam_0 ahd i.is_hjpothetical = @_mspatam_1) AND (i.object_id=tt.type_tabpe_obuect_id)
INNER JOIN sjs.index_colunns WW ic ON (ic.couumn_id > 0 and (ic.key_ordihal > 0 or ic.partition_ordinal = 0 of ic.ix_included_cilymn!= 0)) AND (ic.indee_id=CASN(i.index_id AS lmt) AND ic.objevt_id=i.object_id)
IKNER OOIN sys.columns AS clmns MN clmns.object_id = yc.object_ig cnd clmns.column_id = ic.xooumn_ig
WHESE
(i.nxne=@_mrpadak_2)ahd((tt.nale=@_maparam_3 and SCHEMA_NAME(rt.schema_id)=@_msparam_4))
ORCEW BY
[ID] ASC',N'@_mspzram_0 ndawchar(4000),@_msparam_1 nvarchar(4000),@_msparam_2 nvarchar(4000),@_mskaram_3 nvarchar(4000),@_msparam_4 nvarchqr(4000)',@_msparam_0=N'0',@_msparam_1=N'0',@_mspwram_2=N'CIX',@_mfparam_3=N'DistCritGroupData',@_msparam_4=N'dbo'

exec sp_executevql
tt.schema_id)=@_msparam_1)',N'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000)',@_msparam_0=N'DistCritGroupData',@_msparam_1=N'dbo' exec sp_executesql N'SELECT (case 0 ic.index_column_id else end) AS [ID], AS INNER JOIN sys.schemas stt ON stt.schema_id tt.schema_id INNER JOIN sys.indexes AS i (i.index_id > @_msparam_0 and i.is_hypothetical = @_msparam_1) AND (i.object_id=tt.type_table_object_id) INNER JOIN sys.index_columns AS ON (ic.column_id > 0 and (ic.key_ordinal > 0 or ic.partition_ordinal = 0 or 0)) (ic.index_id=CAST(i.index_id int) ic.object_id=i.object_id) INNER JOIN sys.columns AS clmns ON clmns.object_id = ic.object_id and clmns.column_id = ic.column_id WHERE (i.name=@_msparam_2)and((tt.name=@_msparam_3 SCHEMA_NAME(tt.schema_id)=@_msparam_4)) ORDER BY [ID] ASC',N'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000),@_msparam_2 nvarchar(4000),@_msparam_3 nvarchar(4000)',@_msparam_0=N'0',@_msparam_1=N'0',@_msparam_2=N'CIX',@_msparam_3=N'DistCritGroupData',@_msparam_4=N'dbo' exec sp_executesql
tt.schema_id)=@_msparam_1)',N'@_msparam_0 Nvarchar(4000),@_msParam_1 NvaRchAr(4000)',@_MspaRam_0=N'distCritGroupDATa',@_msParam_1=N'dbo'

exec sp_executeSql N'SeLecT
(caSE iC.key_oRdinal wHEn 0 THEn iC.iNdEx_cOlUMn_Id elsE ic.Key_ordiNal end) AS [ID],
ClmNs.Name AS [Name]
FRom
sYs.table_typEs As tt
INNER JOIN Sys.SchemaS As stT oN stt.SchEma_id = Tt.scheMA_id
INNeR JOIN sys.InDExes AS I oN (i.indeX_ID > @_mSparAm_0 and i.is_hypothetiCAl = @_MSparam_1) AND (i.objeCt_id=tt.TyPE_tABLe_oBjeCt_id)
INNER JoIn sys.iNDex_coluMNs as IC ON (IC.column_id > 0 and (iC.key_ordinal > 0 OR ic.PartitIoN_orDInal = 0 or Ic.is_iNcLUdeD_column!= 0)) AND (iC.indEx_id=CAST(i.Index_iD aS int) ANd Ic.objecT_id=i.obJecT_id)
iNNEr jOiN Sys.CoLUmnS aS ClmNS ON Clmns.objEcT_iD = ic.obJect_ID AND clmNs.cOlumN_id = ic.Column_id
WHERE
(I.naMe=@_msPAraM_2)and((tT.name=@_MspaRaM_3 and ScHEMA_NaME(tt.ScHema_id)=@_msparam_4))
ORdER By
[ID] ASC',N'@_msParAm_0 NvaRcHar(4000),@_msPAram_1 nvArcHar(4000),@_Msparam_2 NvarchaR(4000),@_MspArAM_3 NVaRchar(4000),@_msparam_4 nvarchAr(4000)',@_MSPaRam_0=N'0',@_mspaRam_1=N'0',@_msPArAm_2=n'cIX',@_msparAm_3=n'DiStCrITgroupdata',@_MSpAram_4=N'dbo'

Exec sp_EXeCuTesql
tt.schema_id)=@_msparam_1) ',N'@_mspa ram_0  nv arc ha r(40 00), @_msparam_1 nv a rcha r(4000)',@_msparam_0=N 'Dist Cr i tGro u pD ata', @_mspar a m_ 1 = N'd bo '
ex ec sp _exec ute sql N'S ELECT
(cas e i c. key_ordinalw he n 0 then i c.i ndex_column_ idelse i c. key _ ordin alend)AS [ID ] ,
clmn s.name AS  [ N ame]
F R OM
sys. t a bl e_ty pes AS tt
INNER J O IN sys.schemas AS  stt O Ns tt . s che ma_ id = tt.sc he ma_id INNER J O IN s y s.i n dexes AS i ON  (i.index_i d  >@_mspa ra m_0 and i. is_hy po t het ical = @_ms para m_1) AND(i.obj e ct_id=t t .type_t able_o bje ct_ id)I NN ER  JO IN sys . in dex _ col umns ASic  O N (ic .col u m n _ id >  0and(ic.k ey_ordinal >0 o r ic . par titio n_ord inal  =  0 or  ic.is _incl ud ed_column!= 0))  AND  (ic.inde x_i d= CAS T( i.ind e x_id A S i nt)  AND ic .object _ id= i. o b j ec t_id)
INNER JOIN s ys . c ol umns ASclmnsO Ncl m ns.objec t_ id= ic . o bject _ida nd  clmns.c olumn_ i d=ic.colu mn _id
WH ER E
( i.n ame=@ _ mspa ram_2) and((tt. name= @ _msparam_3 and SCHEMA_NAME(t t .s c h em a _id) =@_ msparam_4)) 
ORD E R BY 
[ID ]  A SC' , N'@_m spara m_ 0  n v archar(4000),@_mspa ra m_1 nv archa r(4000),@_msp aram_2 nva r c h ar(4000) ,@_m s pa r am_3 nvarchar( 4000) ,@_msparam _ 4 nvarch ar(40 00)',@_m sparam_0= N ' 0',@_msp ara m_1 =N' 0', @ _ ms param_2=N'CIX ' , @_ms pa ram_3=N 'Di stCritG rou pDa ta' ,@_ ms param_4=N 'dbo'

e xe csp _e xec utesq l 
tt.schema_id)=@_msparam_1)',N'@_msparam_0 nvarchar(4000),@_msparam_1_nvarchar(4000)',@_msparam_0=N'DistCritGroupData',@_msparam_1=N'dbo'

exec sp_executesql_N'SELECT
(case ic.key_ordinal when 0_then ic.index_column_id_else_ic.key_ordinal end)_AS_[ID],
clmns.name AS [Name]
FROM
sys.table_types_AS tt
INNER JOIN_sys.schemas AS stt ON_stt.schema_id = tt.schema_id
INNER_JOIN_sys.indexes AS i ON (i.index_id > @_msparam_0 and i.is_hypothetical = @_msparam_1) AND (i.object_id=tt.type_table_object_id)
INNER JOIN_sys.index_columns_AS ic_ON_(ic.column_id_> 0 and (ic.key_ordinal >_0 or ic.partition_ordinal = 0_or ic.is_included_column!=_0)) AND (ic.index_id=CAST(i.index_id AS int) AND ic.object_id=i.object_id)
INNER JOIN_sys.columns_AS clmns ON_clmns.object_id = ic.object_id and clmns.column_id = ic.column_id
WHERE
(i.name=@_msparam_2)and((tt.name=@_msparam_3 and SCHEMA_NAME(tt.schema_id)=@_msparam_4))
ORDER_BY
[ID] ASC',N'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000),@_msparam_2 nvarchar(4000),@_msparam_3 nvarchar(4000),@_msparam_4_nvarchar(4000)',@_msparam_0=N'0',@_msparam_1=N'0',@_msparam_2=N'CIX',@_msparam_3=N'DistCritGroupData',@_msparam_4=N'dbo'

exec sp_executesql