It is normal for thoughts to arise during meditation. Look upon your thoughts with a non-judgmental, benevolent attitude, to begin with; you do not want to get into conflicts with them. You want to get to understand thinking, before you can hope to master it.
To the beginner in the art of introspection, thought seems almost uncontrollable. But, with experience, we learn to analyse our thought processes in various ways.
By "thought" we mean any consciousness other than direct experiences of matter, mind or self. Thoughts include verbal sentences - whether inside the head or spoken aloud - and non verbal visualisations and imaginations. Many of our thoughts involve value judgments - our affections and appetites - and these often generate emotional responses.
However, sensory experience is not thought. Intuition is not thought. Awareness of the self is not thought. Acts of will (intentions, volitions) are not thought.
During meditation, observers your thoughts - do not analyse them, as that analysis would itself be more thought. However, after meditation, analysis can help. When you understand the structure and causes of your thoughts, they cease to absorb you so much. When you see the underlying foolishness and futility of your thoughts, you become immune to their hypnotic power, and can then disengage from them more readily. This ability helps you to meditate.
The memories and verbal thoughts that arise and go on, seemingly spontaneously and automatically, in meditation (and in the rest of living), are driven by our desires, dislikes, hopes, fears, etc. The thoughts may appear random, but they are a consequence of the soul (the self) over time having certain preferences and making certain choices in action. So, we should accept responsibility for them.
Our thoughts drive on and on - we get caught up in them, reacting to thoughts with more thought,
trying to redress wrongs or improve our situation in one way or another. This is "samaras", the entanglement and unending grind of our minds. It is better to disregard suffering or fancies, and move on. It is better to act than to react. It is best to be content, unafraid and satisfied. Thought, however random it seems, always has underlying causes.
When meditating, place yourself “above” your thought currents. Watch them with some detachment, as they proceed. From this stance as an impassive spectator, your thoughts appear as mere mental events in which you are not too involved.
Ideally, you are aware of your thoughts as they happen, rather than afterwards.
Simultaneous awareness is strong enough to transcend thoughts in full bloom, whereas retrospective awareness allows us to get feebly caught up in them for a while.
You may create positive thoughts - instructions, mantras, or visualisations - to get you started in meditation. You focus on these thoughts to displace the customary chatter of your mind. Such an approach is useful - even necessary - to the beginner. You talk to yourself - acting like your own guide or guru - and this helps you reach a favourable state of mind quickly and effectively. Visualisation - of light or God - can be even more effective than words here, but this is still thought. You must leave all thoughts behind in order to enter the deeper stages of meditation. With experience, you may learn to direct your course through wordless intentions and volitions, instead of positive thoughts. Every sitting is different, and there is no standard roadmap, but the more often and longer you meditate, the quicker and more directly you get there.
Meditation is a process of self-discovery. It must be learnt gradually through practice, through trial and error. As already indicated, positive thoughts can help us get started, and philosophical insights can give us direction, motivation and inspiration. But ultimately any thought stands in our way. So we should treat our thoughts lightly and drop them as soon as we can.