We investigated the chemical evolution of HC3N in six dense molecular clouds, using archival available data from the Herschel infrared Galactic Plane Survey (Hi-GAL) and the Millimeter Astronomy Legacy Team Survey at 90 GHz (MALT90). Radio sky surveys of the Multi-Array Galactic Plane Imaging Survey (MAGPIS) and the Sydney University Molonglo Sky Survey (SUMSS) indicate these dense molecular clouds are associated with ultracompact HII (UCHII) regions and/or classical HII regions. We find that in dense molecular clouds associated with normal classical HII regions, the abundance of HC3N begins to decrease or reaches a plateau when the dust temperature gets hot. This implies UV photons could destroy the molecule of HC3N. On the other hand, in the other dense molecular clouds associated with UCHII regions, we find the abundance of HC3N increases with dust temperature monotonously, implying HC3N prefers to be formed in warm gas. We also find that the spectra of HC3N (10-9) in G12.804-0.199 and RCW 97 show wing emissions, and the abundance of HC3N in these two regions increases with its nonthermal velocity width, indicating HC3N might be a shock origin species. We further investigated the evolutionary trend of N(N2H+)/N(HC3N) column density ratio, and found this ratio could be used as a chemical evolutionary indicator of cloud evolution after the massive star formation is started.