From an epidemiological perspective, nitrates are commonly thought to be adverse to health due to a long-standing restriction on how much nitrate can be in drinking water (50mg/L) or ground water (due to accumulating in vegetables) due to the risk of infantile methemoglobinemia (baby blue syndrome)[1][2] which does appear to apply to vegetables.[3][4] More commonly, the association between processed meat products that are pink in color (which very commonly use sodium nitrate as a preservative) and cancer occurrence also paints nitrates in the same negative light.[5] Conversely, vegetables are commonly stated to not be associated with cancer risk (which then raises concern about whether or not they are the same molecules).
Both consumption of vegetables (most commonly researched is beetroot[6]) and consumption of the sodium nitrate preservative cause increases in serum nitrate and nitrite, and are considered bioequivalent. In some studies that assess nitrate's bioactivity, liquid solutions of sodium nitrate are even used.[7][8][7]
There are still differences between eating processed meat and vegetables in this regard (intake of sodium through the preservative sodium nitrate and higher intake of potassium via vegetables; less conversion of nitrate into nitrosamines with coingested antioxidants) but the molecule itself is the same.