declare @mtbname1 as varchar(50)
declare @mtbname2 as varchar(50)
set @mtbname1 = 'tablename1'
set @mtbname2 = 'tablename2'
select * from (select tb.name , colum.name col from sys.tables tb
inner join
sys.all_columns colum on
tb.object_id = colum.object_id
where tb.name = @mtbname1 )tb1
left outer join
(select tb.name , colum.name col from sys.tables tb
inner join
sys.all_columns colum on
tb.object_id = colum.object_id
where tb.name = @mtbname2)tb2
on tb1.col = tb2.col
where tb2.col is null
union
select * from (select tb.name , colum.name col from sys.tables tb
inner join
sys.all_columns colum on
tb.object_id = colum.object_id
where tb.name = @mtbname1 )tb1
right outer join
(select tb.name , colum.name col from sys.tables tb
inner join
sys.all_columns colum on
tb.object_id = colum.object_id
where tb.name = @mtbname2)tb2
on tb1.col = tb2.col
where tb1.col is null