Does the DNA sequence of a butterfly match that of the caterpillar it used to be?
The genome (entire DNA sequence) of the butterfly would be identical to that of the caterpillar in all somatic cells.  A caterpillar has the genes to produce wings, for example, however at that stage in it's development they are not 'switched on' to make the necessary proteins.  

If you were to sample the mRNA produced from transcription of the DNA in the caterpillar and butterfly stages, there are likely to be many differences.  As in the example I previously used, the mRNAs that are translated into wing-forming proteins are more likely to be apparent in the butterfly than the caterpillar.  When saying this, please be aware that I'm assuming that the regulation of these genes is pre-transcriptional - I'm not an expert of butterfly physiology!