It doesn't sound quite right. You could use these as alternatives,
'I've given years to this company'
'I've given years of my life to this company'
'I've given the best years of my life to this company'
'I've spent the best years of my life at this company.'
Alternatively you could keep it simple and say, 'I've been married for years' or 'I've worked in this company for years.'