This?declare @sql nvarchar(4000)set @sql = ''SELECT @sql = 'SELECT client.Firstname, client.Lastname, client.Address, client.Address2, client.City, client.State, client.Zip, Information1 AS [' + case when isnull(Information1, '') = '' then 'Information1' else Information1 end + '], Information2 AS [' + case when isnull(Information1, '') = '' then 'Information2' else Information2 end + '], Information3 AS [' + case when isnull(Information1, '') = '' then 'Information3' else Information3 end + '], Information4 AS [' + case when isnull(Information1, '') = '' then 'Information4' else Information4 end + '] FROM clientextended inner join client on clientextended.client = client.number'FROM clientextendedtemplateexec sp_executesql @sql
Peter LarssonHelsingborg, Sweden