テーブル変数「@tempattend」を宣言する必要があるというエラーが表示されます。私を助けてください。@tempattendテーブルを@tempTableSelect変数に渡すにはどうすればよいですか?
ALTER PROCEDURE [dbo].[Rl_LM_AHS]
 @SupEmpID nvarchar(10),
 @SectorName nvarchar(300),
 @dateList nvarchar(300),
 @Month nvarchar(5),
 @Year nvarchar(5),
 @SearchType nvarchar(10)
AS
BEGIN
    SET NOCOUNT ON;
    declare @tempTableSelect nvarchar(2000)
    DECLARE @tempattend Table
(
    [Emp.ID] nvarchar(10),
    [Name] nvarchar(60),
    [1] nvarchar(3) null,
    [2] nvarchar(3) null,
    [3] nvarchar(3) null
    upto ..............
    [31] nvarchar(3) null
)
IF (@SearchType = 1)
    BEGIN
--INSERT TEAM LIST TO @tempattend TABLE
 insert into @tempattend([Emp.ID],[Name]) (Select EMP.empID as [Emp.ID],CONCAT(EMP.emp_fname,' ',COALESCE(nullif(EMP.emp_Mname,'') +' ',''),COALESCE(nullif(EMP.emp_Lname,'') +' ','')) as [Name] from EShiftHistory)
set @tempTableSelect = 'select [Emp.ID],Name,' + @dateList +' from @tempattend'
    EXEC (@tempTableSelect)
    END
END