select ID,max(case    吊牌解析 when '客花号' then 吊牌内容 else '' end ) 客花号,
  max(case     吊牌解析 when '客色号' then 吊牌内容 else '' end ) 客色号,
max(case     吊牌解析 when '整理方式_EN' then 吊牌内容 else '' end ) 整理方式_EN,
max(case     吊牌解析 when '时间' then 吊牌内容 else '' end ) 时间
from dbo.T_Sample_TagInfo    
where ID='123'
group by ID
    
select 客花号,客色号,整理方式_EN,时间 from    dbo.T_Sample_TagInfo    pivot (max(吊牌内容) for 吊牌解析 in (客花号,客色号,整理方式_EN,时间)) a
where    ID='123'
    

declare @sql nvarchar(4000)
set @sql='Select ID '
Select @sql=@sql+',max(case when 吊牌解析='''+吊牌解析+ ''' then 吊牌内容 else '''' end) As '''+吊牌解析+''''

     From T_Sample_TagInfo     where ID=123 Group By 吊牌解析
set @sql=@sql +' from T_Sample_TagInfo    where ID=123 group by ID '
select @sql
exec (@sql)