Crows don't lay their eggs in sparrows' nests - they lay them in crows' nests. What you're describing, though, here is brood parasitism. This relieves the parasitic parent of the responsibility of rearing young, building nests, protecting the eggs, etc.
Brood parasitism is seen in a number of duck species, with females laying their eggs in the nests of others. One example is the goldeneye, Bucephala clangula. Interspecific brood-parasites include the most cuckoos and cowbirds, black-headed ducks, and indigobirds, whydahs, and honeyguides. About 1% of all known bird species are obligate brood parasites (never make nests, need a host).
Here is a picture of a reed warbler feeding a cuckoo which was a parasite, its egg having been laid in the warbler's nest.
Parasite nestlings suffer a relatively high mortality, either from rejection by the host (host bird will not feed the parasite) or rejection before fledgling (once nestling graduates to tree branch, the hosts stop feeding it). However, clearly since cowbirds and cuckoos are still alive and well, enough of them do survive.
Do they think they are of the host species? There was no literature I could find on this. While the parasite messes up the host parents and 'siblings' (when there are surviving 'siblings'), there is much less follow-up done on the behavior of the parasite once fledged. Common sense will therefore need to come into play.
If a cowbird thought it was an indigo bunting, it would not be able to reproduce, as it would try to attract a bunting mate and fail. Since the hosts continue to experience parasitism over many generations, and the population of parasites does not necessarily decline in a given area over several generations (in some areas, it is the host population that declines), I would have to say, yes, the bird 'knows' it's different (probably only on an instinctual - not cognitive - level); the parasite bird feels nothing about its bad behavior, and does not learn their own behavior from their host parents. Instinct takes over; they mate with their own kind, and continue to parasitize the host birds' nests.
Host–parasite coevolution beyond the nestling stage? Mimicry of host fledglings by the specialist screaming cowbird
Brood parasitism by cowbirds: risks and effects on reproductive success and survival in indigo bunting