Mercer Interview Question

How to optimize the Stored Procedure