Identifying the Problem
The details from the trace will tell you exactly where your problem is, but
you still have to figure out what it is.
The actual process of optimization will be trial and error. You will likely
have to run the offending statements several times until you get them right. If
your code is essentially a select which doesn't modify data, you can just run
it over and over. But if it modifies data you should run it in a
transaction/rollback block so you can repeat it:
A simple select:
Select * from authors
where phone like '408%'
or
exec sp_selectStatement
An updating statement:
begin tran
go
update authors
set phone = 'N/A'
where phone like '408%'
go
rollback
go
or
begin tran
go
exec sp_updatingStatement
go
rollback
go
Use SQL Profiler, Query Analyzer's Show Execution Plan, and/or Statistics
IO to see how long each statement is taking paying attention to cpu time.