You could try something like this:
with aa as(
select 'G' Type, 'txtNameLeaseCo' ControlNameID, 'TextBox' [Control Type], 1 Visible, 0 Enable, NULL ColumnNo
union all
select 'U' Type, 'tcMain' ControlNameID, 'TextBox' [Control Type], 0 Visible, 1 Enable, 1 ColumnNo
union all
select 'U' Type, 'txtNameLeaseCo' ControlNameID, 'TextBox' [Control Type], 0 Visible, 1 Enable, NULL ColumnNo
union all
select 'G' Type, 'txtAddress' ControlNameID, 'TextBox' [Control Type], 1 Visible, 0 Enable, NULL ColumnNo
)
, bb as(
select *,
count(*) over (partition by ControlNameID) cnt
from aa
)
select
Type,
ControlNameID,
[Control Type],
Visible,
Enable,
ColumnNo
from bb
where cnt = 1
or (cnt = 2 and Type = 'U')
order by
Type,
ControlNameID
;
Refer to
SQL Server Query question[
^] - where the inspirational idea came from