MySQL:
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v';
riferimento:The INFORMATION_SCHEMA VIEWS Table
SQL Server:
USE databasename
GO
EXEC sp_helptext viewName
o anche una query come questa:
SELECT TABLE_NAME as ViewName,
VIEW_DEFINITION as ViewDefinition
FROM INFORMATION_SCHEMA.Views
dove potresti aggiungere un WHERE
per recuperare solo una vista