If you create and use a table variable before you create the first temp table in the stored procedure, this seems to prevent the invalid object error, i.e.:
<CODE>
CREATE PROCEDURE myproc
AS
DECLARE @dummy TABLE (nothing bit);
INSERT INTO @dummy VALUES (0);
CREATE TABLE #mytemptable
...
</CODE>