Differential diagnosis
Neck pain may come from any of the structures in the neck including: vascular, nerve, airway, digestive, and musculature / skeletal, or be referred from other areas of the body.Major and severe causes of neck pain (roughly in order of severity) include:

Carotid artery dissection
Referred pain from acute coronary syndrome
Head and neck cancer
Infections, including:
Meningitis of several types including sudden onset of severe neck or back pain particularly in teens and young adults which may be fatal if not treated quickly
Retropharyngeal abscess
Epiglottitis
Spinal disc herniation – protruding or bulging discs, or if severe prolapse. Spondylosis - degenerative arthritis and osteophytes
Spinal stenosis – a narrowing of the spinal canalMore common and lesser neck pain causes include:

Stress – physical and emotional stresses
Prolonged postures – many people fall asleep on sofas and chairs and wake up with sore necks. Minor injuries and falls – car accidents, sporting events, and day to day injuries that are really minor. Referred pain – mostly from upper back problems
Over-use – muscular strain is one of the most common causes
Whiplash
Pinched nerveAlthough the causes are numerous, most are easily rectified by either professional help or using self help advice and techniques. More causes can include: poor sleeping posture, torticollis, head injury, rheumatoid arthritis,
Carotidynia, congenital cervical rib, mononucleosis, rubella, certain cancers, ankylosing spondylitis,
cervical spine fracture, esophageal trauma, subarachnoid hemorrhage, lymphadenitis, thyroid trauma, and tracheal trauma. Treatment
Treatment of neck pain depends on the cause. For the vast majority of people, neck pain can be treated conservatively. Recommendations in which it helps alleviate symptoms include applying heat or cold.
Nitroglycerin, also known as glyceryl trinitrate (GTN), is a medication used for heart failure, high blood pressure, anal fissures, painful periods, and to treat and prevent chest pain caused by decreased blood flow to the heart (angina) or due to the recreational use of cocaine. This includes chest pain from a heart attack. It is taken by mouth, under the tongue, applied to the skin, or by injection into a vein.Common side effects include headache and low blood pressure. The low blood pressure can be severe. It is unclear if use in pregnancy is safe for the baby. It should not be used together with medications within the sildenafil (PDE5 inhibitor) family due to the risk of low blood pressure. Nitroglycerin is in the nitrate family of medications. While it is not entirely clear how it works, it is believed to function by dilating blood vessels.Nitroglycerin was written about as early as 1846 and came into medical use in 1878. It is on the World Health Organizations List of Essential Medicines. The drug nitroglycerin (GTN) is a dilute form of the same chemical used as the explosive, nitroglycerin. Dilution makes it non-explosive. In 2019, it was the 184th most commonly prescribed medication in the United States, with more than 3 million prescriptions. Medical uses
Nitroglycerin is used for the treatment of angina, acute myocardial infarction, severe hypertension, and acute coronary artery spasms. It may be administered intravenously, as a sublingual spray, or as a patch applied to the skin.