select Distinct (CASE when fc.field_name like 'udf_%' then ca.aliasname else fc.field_name END) "Fields", rt.templatename "Template name" , sd.name "Service Catalog Name", (CASE when rt.is_catalog_template='true' then 'Service Template' else 'Incident Template' END) "Template Type" from requesttemplate_list rt
left join servicedefinition sd on sd.serviceid = rt.parent_service
left join form_customizer fc on fc.form_name = ('WorkOrder_' + rt.templatename)
left join columnaliases ca on fc.field_name like ('udf_%_' + cast(ca.columnaliasesid as varchar))
where rt.templatename not like 'Default Service Item'
order by 2