As of now, no train passes through 12 states, However 16317/Kanyakumari Shri Mata Vaishno Devi Katra Himsagar Express is the train (very close to 12 states) which passes through 10 states and 2 union territory
Starting from Tamilnadu, Kerala, Andhra Pradesh, Telangana, Maharashtra, Madhya Pradesh, Rajasthan, Uttar Pradesh, Haryana, Punjab
And 2 union territory, Delhi and Jammu & Kashmir
Jammu and Kashmir was officially declared and established as a Union Territory on October 31, 2019
It doesn't pass through Karnataka, It passes through Rajasthan only for short stretch Dholpur.
It covers 3790 km, one of the longest distance covering train from South India, (Tamilnadu) to North India (Jammu & Kashmir),
Its a weekly train , operates on Friday.
However in past, 16687/Mangalore Central -Shri Mata Vaishno Devi Katra Navyug Express used to be train passing through 12 states including Karnataka state. Before Jammu & Kashmir used to be state.
Only difference is it starts departs at Mangalore Central in Karnataka and goes via Kozhikode, Shoranur Jn in Northern Kerala, then proceeds the journey of same route of Himsagar Express.
Now that train is officially discontinued after COVID. Back to days it used to run as Link Express with Tirunelveli Katra Express.