Some scientists will say that a fear of heights (and spiders, snakes, and the dark) are innate, i.e. that we are born with them because they confer an evolutionary advantage. In other words, a fear of heights tends to prevent falls, and a fear of snakes tends to prevent snake bites. We tend to have little control regarding when these fears arise.
However, the amount of fear/anxiety we feel for any given thing or situation can be modulated. For example, many therapists use a strategy called "exposure therapy," exposing the patient to the feared thing or situation repeatedly, in a safe manner, which typically results in a reduction in the intensity of the anxiety response. Another example: when people do regular physical exercise, many studies show that their mood rises and they react less strongly to negative events. They even feel less physical pain when injured (compared to sedentary adults). There are many other strategies one can use to modulate painful feelings, which can be found in the book of Sudism (sudism.org). EDIT (Dec 14 2019): Sudism is a philosophy, not a science, owing to the fact that it is not currently possible to precisely measure positive and negative affect (i.e. our feelings of pleasure and pain). Take care.
EDIT (Dec 14 2019) -- Here are some supporting references that illustrate that (A) exposure therapy is beneficial for reducing anxiety, that (B) physical exercise is beneficial for reducing physical pain, and that (C) certain fears are innate:
From this meta-analysis: Parsons, Thomas & Rizzo, Albert. (2008). Affective outcomes of virtual reality exposure therapy for anxiety and specific phobias: A meta-analysis. Journal of behavior therapy and experimental psychiatry. 39. 250-61. 10.1016/j.jbtep.2007.07.007.
"A good deal of research has shown that exposure therapy is effective for reducing negative affective symptoms (Rothbaum & Schwartz, 2002)."
From this review of literature on exposure therapy: Johanna S. Kaplan, PhD and David F. Tolin, PhD. (Sep 2011). Exposure Therapy for Anxiety Disorders. Psychiatric Times.
"Over a quarter of the people in the US population will have an anxiety disorder sometime during their lifetime. It is well established that exposure-based behavior therapies are effective treatments for these disorders; unfortunately, only a small percentage of patients are treated with exposure therapy."
From this study: Einat Kodesh & Irit Weissman-Fogel. Exercise-induced hypoalgesia – interval versus continuous mode. Applied Physiology, Nutrition, and Metabolism, 2014, 39(7): 829-834, 10.1139/apnm-2013-0481.
"In conclusion, interval exercise (85% HRR) has analgesic effects on experimental pain perception. This, in addition to its cardiovascular, muscular, and metabolic advantages may promote its inclusion in pain management programs."
From this 2017 press release from the Max Planck Society on recent research comparing infants' reactions to various stimuli (from benign fish and flowers to non-benign snakes and spiders):
"We conclude that fear of snakes and spiders is of evolutionary origin. Similar to primates, mechanisms in our brains enable us to identify objects as 'spider’ or 'snake’ and to react to them very fast."