>Now when I run it first time it works fune and fast when I run it second time it hangs up for an about 20-30 seconds and then works. So my real complain is not that something is not working, but how can I escape these delays, and what did i do wrong, which probably the main reason of having them (delays).
Start with the tools that are available to you. Use the SQL Profiler to determine whether the delay is actually SQL Server or not.
Use the SP:Completed event and make sure that you have the Duration data element captured. If it is within your stored procedure, run the test again and this time capture the SP:StmtCompleted event.
Also, make sure that your connection is not being blocked by another connection. You can use the Server Enterprise Manager or the Query Analyzer and the sp_lock system stored procedure (check the SQL Server Books Online for more info on this proc.)
-Mike