Here is a solution:
DECLARE @sql nvarchar(MAX)
SELECT @sql = string_agg(convert(nvarchar(MAX),
concat('
SELECT Num1, Num2, Num3, Num4, Total= ', Total, '
FROM (VALUES(', Num1, ',', Num2, ',', Num3, ',', Num4,
')) AS V(Num1, Num2, Num3, Num4)')), ' UNION ALL ')
FROM #temp
PRINT @sql
EXEC sp_executesql @sql
If it looks complicated, it is because you are trying to something SQL is not intended for.