You will beat it.
I suffered from it very badly when I was younger. I was at a boarding school and my actions were hidden from no one. Everything I did I had to do 5 times for each member of my family. If I didn't, I believed that one of them would die. What I had to do related entirely to the whims of my imagination and I was powerless to stop it. I had to close doors, walk up and down stairs, turn lights on and off, walk on certain spots, have a certain number (5) steps between some places. This would be done when working to class so the people walking with me would just leave me behind. I was obsessed with praying for my family - I would have to recite a prayer to myself 5 times and within that there were even more complexities that I was compelled to obey. I would do this in the same spot everyday right outside the dining hall so everyone could see me. I would be there probably 45 minutes or so then move on. I alienated most (NOT all) of my friends. A lot of people mocked me but some were intrigued. I said nothing.
I have splurged somewhat and it is not my intention to compete in an "I'm weirder than you" game. I just want to say is that you are not alone and you will fight it and win. I did. How I did it is complicated and for some reading this the 'how' will be scorned. One day, I was in the middle of a mammoth prayer session and for a moment snapped out of it and just asked, pleaded - not out loud - that if there was anyone there, to help me. This was the first time I had asked for any kind of help. A few weeks later I was about to climb back up some stairs and I felt different, like a wave of calm had passed over me and it just said stop. At the time I believed it was God because that made sense. Now I believe it was something more abstract, something within, a part of me perhaps, conscience, reason. I don't know because I still cannot rationalize it so perhaps God remains the best description. Whatever it was it came from within - that is the key. And if it was within me it is within you.
I am not suggesting the answer to OCD is prayer. I wish I had an answer that was absolute but I suspect that psychological illnesses are too complex: they require a reining in of the brain which is slippery and at times conniving. I am sure that before advances in psychoanalysis, people suffering psychologically believed they were cursed or possessed. OCD seems like a form of self-punishment to me. It also stems from a desire for order, that you are in control. I have only just considered those reasons but I think they are valid
The resolution will be different for everyone but it will be combination of these things I think:
Asking for help (a release)
Getting as a close as you can to a state of rational thought: realizing that these are tricks the mind is playing.
Self-belief. This is a process of momentum. For me everything did not suddenly stop but that first moment I resisted, I gained a sense of power and this built. This power, or perhaps empowerment is a better word, led to belief, pride (sense of achievement) and ultimately happiness.
To not fear staring the problem in the face and challenging it. There will be a part of your brain that knows what you are doing is unnecessary (otherwise you wouldn't have posted). Train this part of your brain, indulge it.
Making a conscious effort to be strong.
Believing in yourself.
Do not give up.
Please do not look at these as cliches, they are the absolute facts.
It will be okay.