Yes, we can do it in another way. This just a suggestion, you can work and test it.
Here am not using 1 - 30 columns. The problem occurs when we need to add or remove columns.
Every tables, procedure, packages needs to be reworked again.
Example below, am storing the columns as rows.
Procedure used to convert rows to columns using PIVOT, STUFF, FOR XML PATH statements.
CREATE TABLE #temptable (ScreenName varchar(max), ScreenRows varchar(1), Seats varchar(2), selected_seats numeric(10));
with List as (
SELECT a.screenrows, ROW_NUMBER() OVER (ORDER BY a.srid) AS 'Seats', a.SRID, a.SCID
FROM dbo.ScreenRows_Master
a cross join
dbo.ScreenSeat_Details b
where a.srid = 3
)
insert into #temptable
select d.ScreenName,
l.ScreenRows, l.Seats,
case when c.SeatNo IS NULL then '0' else c.SeatNo end 'selected_seats'
from List l left join
dbo.ScreenSeat_Details c
on l.SRID = c.SRID and l.Seats = c.SeatNo
left join dbo.ScreenMaster d
on l.SCID= d.SCID
declare @alias_period_list as varchar(max)
declare @period_list as varchar(max)
declare @dynamic_pivot_query as varchar(max)
select @alias_period_list = stuff((select ',['+Seats+']' from #temptable for xml path('')),1,1,'')
select @period_list = stuff((select ',['+Seats+']' from #temptable for xml path('')),1,1,'')
set @dynamic_pivot_query =
'select [ScreenName],[ScreenRows],'+@alias_period_list+'from (
SELECT
[ScreenName],[ScreenRows],[Seats],[selected_seats] FROM #temptable) as S
Pivot(SUM([selected_seats])
FOR [Seats] IN ('+@period_list+')) as P'
exec(@dynamic_pivot_query)
drop table #temptable
output

Out of 1 ==> 16 seats, seat numbers 1, 3, 4 ,5 of Row "B" of Screen1 is booked.
This is not a simple project.