 declare @SQL nvarchar(max) = 'select '+    (   select ',T.X.value(''Column[@Name = "'+T.ColName+'"][0]/@Value'','''+T.DataType+''') as '+quotename(T.ColName)   from (        select T.X.value('@Name', 'nvarchar(000)') as ColName,               T.X.value('@DataType', 'nvarchar(000)') as DataType        from 