The first thing that you need to do in order to stop yourself from procrastinating in school is to admit to yourself that you are indeed indulging in this act. You cannot bring about any change in you unless you realize the need for it.
Next, try to identify the reasons that are causing you to adopt a lazy approach and attitude towards actions and tasks that need to be done on urgent basis. You need to be honest with yourself while spotting out the reasons that cause you to procrastinate. Some common reasons include fear of failure and consequent obsession with perfectionism, distractions and misguided priorities.
Set realistic goals for yourself in school and focus on accomplishing them. You do not have to aim too big, as that will only cause your fear of failure to grow and consequently result in you spending more time in the thinking and preparation phase than actually doing something. Understand that planning on doing something is completely different from actually doing something.
Do not allow yourself to become distracted easily. Remain focused on the work at hand such as class-work, projects, etc. If your friends keep trying to get your attention while you are busy doing something important, tell them you are busy. You will have plenty of time to hear them out and have fun with them later. It is extremely tempting to delay something important to a later time when we find ourselves with an opportunity to have fun, but you must not give in to this temptation. Understand all that is at stake.
Set your priorities and review them in order to ensure that they are straight. When you are at school, your basic aim should be to learn, which involves doing what your teachers assign you to do on time. Having fun and playing with your friends is not why your parents enrolled you in school. Unless you set your priorities right, you will have a hard time distinguishing between what is important and what is not.
Find a work buddy, someone who stays focused in class and does his/her work on time. This will help to keep you motivated.