Merge multiple table output but indicate which tables the records came from
You can use a full outer join between your tables and check against null values to figure out where the data comes from.

select isnull(A.ID, B.ID) as ID,
       isnull(A.Name, B.Name) as Name,
       case
         when A.ID is null then 'B'
         when B.ID is null then 'A'
         else 'A+B'
       end as Tables   
from TableA as A
  full outer join TableB as B
    on A.ID = B.ID