SELECT Results.Menu_ID as menuId,
REPLACE(RTRIM((SELECT CAST([child_prop] AS VARCHAR(MAX)) + ' '
from Hierarchy hr
full outer join SY_FND_RESP_MENU_AVOID avd
on sub_menu_id = avd.menu_id
and avd.RESPONSIBILITY_ID = 25
where avd.MENU_AVOID_ID IS NULL
and ( hr.Menu_ID = Results.Menu_ID )
FOR XML PATH (''))), '', '') AS child_Details
FROM Hierarchy Results
GROUP BY Results.Menu_ID