If i understand your problem you have created a function which get a input parameter with array type that pass query structure to function and function dynamically create an statement,
for calling a table for select or insert statement you should call it by dynamic query, you can call it in your function for example:
Alter procedure func (@tableName nvarchar(100))
as
begin
declare @cmd nvarchar(max) =
N'select * from '+ @tableName
print 1
exec (@cmd)
end
exec func N'Task'
but consider if your database name is also dynamic as your connection string is only with one database!