You can try creating the temp stored procedures this way:
create procedure #mytemp as
begin
select getdate() into #mytemptable;
end
in an SQL script, but not functions. You could have the proc store it results in a temp table though, then use that information later in the script.