If we had good string aggregate function, this could be more pretty, but just to give you an idea:
with cte as (
-- unpivot days into strings
select
T.coursename, A.day, A.moment
from Table1 as T
outer apply (values
(T.day1, T.moment1),
(T.day2, T.moment2),
(T.day3, T.moment3),
(T.day4, T.moment4)
) as A(day, moment)
), cte2 as (
-- concat all days for each moment
select
c.coursename, c.moment,
stuff(
(
select '/' + t.day
from cte as t
where t.coursename = c.coursename and t.moment = c.moment
for xml path(''), type
).value('.', 'nvarchar(max)')
,1,1,'') as days
from cte as c
group by c.coursename, c.moment
)
-- concat final timetable
select
c.coursename,
stuff(
(
select ', ' + t.days + ' ' + t.moment
from cte2 as t
where t.coursename = c.coursename
for xml path(''), type
).value('.', 'nvarchar(max)')
,1,2,'') as timetable
from cte2 as c
group by c.coursename