Agent Auto Lookup

Changed lookup to stored procedure.