The correct size pillow is very important for the health of your spine in particular your neck. Pillows are like shoes they fit everyone differently, but there are some rules you should go by. When you are sleeping you want your neck to be close to neutral as possible, if you are sleeping on your side, you will want your neck inline with the rest of spine. Your neck should not be tilting upwards or downwards, and the wider your shoulders are the more support and thickness you will need in your pillow. If you are sleeping on your back, you will want good support underneath your neck and the same principles apply as to keeping your spine neutral not with head going upwards or sloping downwards.
A good way to tell if you need a new pillow is you are waking up constantly with a sore neck. After a good night sleep with good support your neck if healthy should feel good, not stiff and sore. You can also give extra support to your neck buy rolling up a small towel about 3-4 inches round and using elastics to keep it in place, if you wake up with your neck feeling better when using the rolled up towel, then it is probably time to get a new pillow. Pillows come in all shapes and sizes and different types of materials such as foam, memory foam and latex. I like the latex pillows because they are cooler than the memory foam and they retain their shape through the night but it is definitely a personable preference when it comes to the fabric of your pillow.
With a lot of our waking hours spent on computer with the head down and forward our necks do take a lot of repetitive stress and the proper support while sleeping will definitely help take that pain in the neck away!