Prueba esto a ver si es lo que quieres
Código SQL:
Ver originalCREATE PROCEDURE MostrarEstructura(
@TableName VARCHAR(50)
)
AS
IF EXISTS (SELECT * FROM dbo.sysobjects
WHERE id = OBJECT_ID(N'[dbo].['+@tableName+']')
AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
SELECT
cols.name AS 'Nombre del Campo',
typs.name AS 'Tipo de Datos',
cols.prec AS 'Precisión',
cols.Scale AS 'Escala',
Allownulls AS 'Permite Nulos',
c.text AS 'Valor por Defecto',
pk.xtype AS 'Primary Key',
indx.name AS 'Nombre del Índice'
FROM sysobjects sobj
INNER JOIN syscolumns cols ON sobj.id=cols.id
INNER JOIN systypes typs ON cols.xusertype=typs.xusertype
LEFT JOIN syscomments c ON cdefault=c.id
LEFT JOIN sysindexkeys ik ON ik.id = cols.id AND ik.colid = cols.colid
LEFT JOIN sysindexes indx ON indx.id = ik.id AND indx.indid = ik.indid
LEFT JOIN sysobjects pk ON indx.name = pk.name AND pk.parent_obj = indx.id AND pk.xtype = 'PK'
WHERE cols.id = OBJECT_ID(@tableName)
ELSE
PRINT 'No existe ninguna tabla llamada '+@tableName + ' en la base de datos ' + db_name() + '.'
RETURN
Tomado de aquí:
http://www.webtutoriales.com/tutoria...-mssql.39.html