Assuming there was no trauma nor fever
; most 'stiff necks' are from the result of poor quality of sleep
Check your pillow and mattress at home and replace if needed. Try a warm compress; or a warm/hot shower may be what the doctor ordered. From the osteopathic side you may also have an elevated first cervical rib which is easily treated. If the problem persists see your doctor.