I'm not sure what you're asking.
I'd think pretty obviously, if an employer wants to hire a programmer and they have a choice between someone with 2 years of programming experience and someone with 2 years experience as, say, an auto mechanic, the person with programming experience will have an advantage.
Would an employer looking to hire a programmer view someone who had worked 2 years as an auto mechanic less favorably than someone who had zero experience? I doubt it. If you did a good job as an auto mechanic, that at least proves something about your work habits. Did you show up on time, work well with others, play by the rules, etc?
Experience in an unrelated field is surely worth LESS than experience in the relevant field, but it's worth more than zero.
Unless you're experience is in a field that's very disreputable -- you were a drug dealer or a pornographer or a politician or something -- I can't imagine that an employer would view it as a minus.