How to handle the output if using stored procedure?

I write a stored procedure for selecting data from one table and display them separately as following:

if contact_type=1
Select name as Order_Contact where order_id=’’ and contact_type=1
if contact_type=2
Select name as Other_Contact where order_id=’’ and contact_type=2

Some orders have only one contact type, but others have both. The stored procedure run correctly in database, but it fails in WM.

The steps that I do in WM:

  1. Call this stored procedure.
  2. Add set two result sets, Order and Other.
  3. Assign Order_Contact to Order result set and Other_Contact to Other result set.
  4. Run the flow with an order id that has only order contact type, I get the exception “The column name Other_Contact is not valid”.

Is there any condition in result set page?