About the only difference between the two will be the ANSI settings of the session. Query Analyzer will turn a few settings on when running the procedure. The SQL Agent doesn’t turn any on, and uses the server default unless you specify any in the job step properties. These different settings will force the SQL Server to use a different execution plan for the SQL Agent as it uses for you.
Setup SQL Profiler and have it monitor the SQL Server, then run the job. Have SQL Profiler give you the execution plan which is being used so that you can see exactly what it’s doing.
You may find that you need to add the same ANSI Settings to the SQL Agent job.
It could also be because database maintenance is being performed at the time that the job is running, and that maintenance is not being run when you run the procedure during the day. Check for other jobs which are running at the same time as the SQL Agent job which is having the performance problem.