SP taking more time : I have an Stored procedure in my database.

When i am calling stored procedure, some time it takes 1 minute, some time it takes 10 minutes, some time it takes more than that. 

the below step alone taking more time in the whole process, not sure if this poor query and need to re-write the SP or some other server issue 

  IF (EXISTS 
  (SELECT 1 FROM table1 PWI (NOLOCK)
  INNER JOIN table2 W (NOLOCK) ON PWI.ID = W.ID
  WHERE W.Flag = 1 AND PWI.PatID IN (SELECT PatID FROM @table3) AND W.SubID IN (SELECT SubID FROM @table4)))

Please help to fix this issue