Can I become a Commercial Pilot if I had OCD?
Maybe. It depends on how severe the OCD was, the root causes of the disorder, the length of time since the last episode and the likelihood of future recurrence. The aviation medical system is set up to be conservative for good reasons, the cockpit is a bad place to become fixated. 

If your condition is/was stress related then I would expect it to be a no, flying can be very stressful at times, you have to be able to handle fluid, difficult scenarios. 

Your best answer will be from an Aviation Medical Examiner, I suggest you speak to one, it's what they're for.