Dear friend,
Neck pain is due to bad posture which has been accumulating over a period of months or years like watching phone and working on laptops or incorrect pillows below neck which stretches the nerves and ultimately causes spasm which is what has happened to you.
Short term treatment is medication and physiotherapy but no exercise.
Long term solution is to get the right posture.
When you are painfree then specific exercises pertaining to neck and shoulder needs to be done which will avoid its recurrence.
Next Steps
Please consult with Dr Sachin Jain for more guidance, medication and long term relief
Health Tips
https://www.practo.com/jaipur/doctor/dr-sachin-jain-orthopedist