• Something like this might get you started:

    declare @strSQL as varchar(max)

    set @strsql = (select 'select COL1_D as ' + col1_h +

    ', COL2_D as ' + col2_h +

    ', COL3_D as ' + col3_h +

    ', COL4_D as ' + col4_h +

    ', COL5_D as ' + col5_h +

    ', COL6_D as ' + col6_h +

    ', COL7_D as ' + col7_h +

    ', COL8_D as ' + col8_h +

    ', COL9_D as ' + col9_h +

    ', COL10_D as ' + col10_h +

    ' from tb_dados ' +

    'inner join tb_header on tb_dados.ID_header = tb_header.ID_Header ' +

    'where tb_header.codigo = ''CARRO_01''' from tb_header where codigo = 'CARRO_01'

    )

    exec (@strSQL)