You are describing logismoi (plural) (logismos (singular)), which is really just an orthodox theological word for “thoughts.” Owen is right: EVERYONE suffers from these to some extent or another.
I will say that I used to have many similar problems as you describe during prayer, and occasionally still do. You should read some books or writings on the topic of logismoi. One of the first books I read on it was “Mountain of Silence.” In it, Fr. Maximos describes just the type of thoughts you are talking about and how to deal with them. I will try to summarize generally.
The first thing you must realize is that those thoughts are NOT from you. They are from outside of you: from the demons, from the outside world. Did you WILL to have those thoughts? No, right? They just appear there? And you can’t stop them? You see? They from OUTSIDE of you. Therefore, you have NO need to feel guilty about them, or to let them bother you. I know that sounds hard, but imagine: why feel guilty for something that is not from you? If you were praying, and someone yelled some obscene word through the window, what would you do (assuming you can’t shut the window, which is your current problem)? You would ignore it, maybe cross yourself, laugh to yourself, and pick up right where you were at. If the guy kept yelling, you’d try to just ignore his yelling. Would you feel guilty about what he said? Of course not! And guess what would happen? That guy who was trying to distract you from your prayer will see that you pay him no attention. And soon, he’ll leave you and go find someone else to yell at.
That guy outside your window is the demons. They yell these things at you, and you listen, you stop your prayer, you get distracted. That’s what they want! You must ignore them.
Fr. Maximos said that most lay people don’t even have to confess logismoi. Now, if you are under obedience and you have a spiritual father, maybe you confess all of your thoughts. And in general, you would want to confess that you suffer from logismoi and distracting thoughts during prayer, because your priest can help you. But the idea is that you don’t have to confess those thoughts as if they are SINS. They’re not. They’re not your actions. They’re not products of your will. They’re just outside distractions to be ignored . . . and then they will go away.
Fr. Maximos described logismoi as flies flying in a window. They come in and you pay attention to them. So they land on you. Your attention to them is like a piece of pie on the table in the room of your mind. They come in and find something to stick to. But if you ignore them, they fly in, find nothing to land on, and so fly right back out. That is, you are praying, and some odd thought comes in (“God, don’t hear my prayer!” or “I hate God” or some sexual thought, or any other silly thing), and you laugh, cross yourself, and just keep on going with your prayer as if nothing happened. This works.
For me, the key was realizing that these thoughts were outside of me, that I didn’t have to feel guilt for them. Then I laughed at them at first. What odd things Satan puts in your head! Then soon I just ignored them. And I’m ABLE to do it because I realize they are not originating in me. They are temptations and tricks of the demons. So if they assault you at prayer, or in church, or right before you go up to the chalice, you can just shrug them off and thank God for his mercy.
You should read more on this and on logismoi. Mountain of Silence is good. So is Hierotheos Vlachos’s “The Illness and Cure of the Soul in the Orthodox Tradition.” I’m sorry if I’ve not explained it well, but if you take nothing else away, remember this: Those thoughts are not of you. They are from outside, from the demons. Ignore them, laugh at them, but whatever you do, do not feel guilt for them, and do not quit praying!