IF OBJECT_ID('tempdb..#Results',N'U') IS NOT NULL
DROP TABLE #Results
SELECT st.Name, st.FatherName, st.RollNo, at.AttendanceDate , atst.Status
INTO #Results
FROM Students st
inner JOIN SectaionJunction sec
ON sec.ID = st.ClassSectionJunctionID
inner join Attendance at on at.ClassSectionJunctionId=sec.ID
inner join [dbo].[AttendaceStatus] atst
on...