added option leg select stored proc